﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            XmlDocument doc = new XmlDocument();

            //Using the object create the XML declaration object 
            XmlNode docNode = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
            //Append the XML declaration to the doc object 
            doc.AppendChild(docNode);
            //<?xml version="1.0" encoding="UTF-8"?> 

            XmlNode documentNode = doc.CreateElement("document");
            doc.AppendChild(documentNode);

            XmlNode headerNode = doc.CreateElement("header");
            headerNode.AppendChild(doc.CreateTextNode("100"));

            XmlAttribute transAttribute = doc.CreateAttribute("Type");
            transAttribute.Value = "Transfer";
            headerNode.Attributes.Append(transAttribute);
            documentNode.AppendChild(headerNode);

            doc.Save("test.xml");

        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (Utility.DeleteFile("test.xml"))
                Utility.LogFile("File Deleted");
          
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Utility.Timer(3000);
        }
    }
}
